﻿namespace Example.Runtime.InteropServices
{
    using System;
    using System.Diagnostics.CodeAnalysis;
    using System.Runtime.InteropServices;

    /// <summary>
    /// Use this interface to draw the contents of an element to a specified device context, normally a printer.
    /// </summary>
    /// <seealso href="http://msdn2.microsoft.com/library/aa752274(VS.85).aspx">MSDN</seealso>
    [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "HTML", Justification = "This is the correct interface name casing.")]
    [Guid("3050f669-98b5-11cf-bb82-00aa00bdce0b")]
    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    [ComVisible(true)]
    [ComImport]
    public interface IHTMLElementRender
    {
        /// <summary>Draws the contents of the element to the specified device context.</summary>
        /// <param name="hdc">An HDC specifying the device to be drawn to, typically a printer.</param>
        /// <seealso href="http://msdn2.microsoft.com/library/aa752273(VS.85).aspx">MSDN</seealso>
        [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "h", Justification = "This is the correct spelling.")]
        void DrawToDC([In] IntPtr hdc);

        /// <summary>
        /// Modifies the device context to ensure that
        /// <see href="http://msdn2.microsoft.com/library/aa752273(VS.85).aspx">IHTMLElementRender::DrawToDC</see>
        /// works properly on all printers.
        /// </summary>
        /// <param name="bstrPrinterName">A BSTR containing the printer name.</param>
        /// <param name="hdc">
        /// An HDC for the printer specified by bstrPrinterName. After this method returns, pass hDC to
        /// <see href="http://msdn2.microsoft.com/library/aa752273(VS.85).aspx">IHTMLElementRender::DrawToDC</see>
        /// to draw to the printer.
        /// </param>
        /// <seealso href="http://msdn2.microsoft.com/library/aa752275(VS.85).aspx">MSDN</seealso>
        [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "bstr", Justification = "This is the correct spelling.")]
        [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "h", Justification = "This is the correct spelling.")]
        void SetDocumentPrinter([In] [MarshalAs(UnmanagedType.BStr)] string bstrPrinterName, [In] IntPtr hdc);
    }
}